﻿@model ItemControllerModel.Index
<div>
    <div class="ui-box  ui-box-alpha">
        <div class="ui-box-head">
            <div class="ui-box-head-border">
                <div class="ui-box-head-title">
                    商品管理
                </div>
                <a href="#" class="ui-box-head-more">去购物</a>
            </div>
        </div>
        <div class="ui-box-container">
            <div class="ui-box-content">
                @using (Html.BeginGetForm(null))
                {
                    <div class="row-fluid">
                        <div class="span4">
                            <label>
                                Id/Name ：<input type="text" name="keyword" class="input-medium" maxlength="20"   value="@(Model.Keyword)" /></label>
                        </div>
                        <div class="span4">
                            <label>
                                商家编码：<input type="text" name="outerId" class="input-medium" maxlength="20"  value="@(Model.OuterId)" />
                            </label>
                        </div>
                        <div class="span4">
                            <label>
                                一级类目：
                                <select name="categoryRootId" class="input-medium">
                                    <option value="0">全部类目</option>
                                </select>
                            </label>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span4">
                            <span>商品价格：<input type="text" name="priceFrom" class="input-mini" maxlength="10" value="@(Model.PriceFrom.HasValue ? Model.PriceFrom.Value.ToString("N") : string.Empty)"/>
                                <span>到 </span>
                                <input type="text" name="priceTo" class="input-mini" maxlength="10" value="@(Model.PriceTo.HasValue ? Model.PriceTo.Value.ToString("N") : string.Empty)"/>
                            </span>
                        </div>
                        <div class="span4">
                            <span>总销售量：<input type="text" name="saleFrom" class="input-mini" maxlength="5" value="@(Model.SaleFrom.HasValue ? Model.SaleFrom.Value.ToString() : string.Empty)"/>
                                <span>到 </span>
                                <input type="text" name="saleTo" class="input-mini" maxlength="5" value="@(Model.SaleTo.HasValue ? Model.SaleTo.Value.ToString() : string.Empty)"/>
                            </span>
                        </div>
                        <div class="span3 offset1">
                            <button type="submit" class="btn">
                                搜 索</button>
                        </div>
                    </div>
                }
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <div class="ui-box-content">
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <div class="tabbable">
                <ul class="nav nav-tabs" style="padding-left: 40px;">
                    <li class="@(Model.Param == 0 ? "active" : string.Empty)"><a href="/item">出售中的商品</a></li>
                    <li class="@(Model.Param == 1 ? "active" : string.Empty)"><a href="/item?param=1">仓库中的商品</a></li>
                    <li class="@(Model.Param == 3 ? "active" : string.Empty)"><a href="/item?param=3">定时上架的商品</a></li>
                    <li class="@(Model.Param == 2 ? "active" : string.Empty)"><a href="/item?param=2">已删除的商品</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active">
                        <table class="ui-table ui-table-inbox ui-table-alpha">
                            <thead>
                                <tr>
                                    <th style="width: 300px;">
                                        商品信息
                                    </th>
                                    <th>
                                        单价(元)
                                    </th>
                                    <th>
                                        库 存
                                    </th>
                                    <th>
                                        总销量
                                    </th>
                                    <th>
                                        上架时间
                                    </th>
                                </tr>
                            </thead>
                            @Model.Items.Each(@<tbody>
                                <tr class="item-header">
                                    <td colspan="2" class="text-align-left">
                                        <input type="checkbox" class="checkbox" value="@(item.Item.Id)" style="margin: 0;"/>
                                        <span>商家编码：@(item.Item.OuterId)</span>
                                    </td>
                                    <td colspan="2">
                                        <span>收藏：@(item.Item.Collection)</span> <span>咨询：@(item.Item.Consultation)</span>
                                        <span>评论：@(item.Item.Commentation)</span>
                                    </td>
                                    <td>
                                        dd
                                    </td>
                                </tr>
                                <tr>
                                    <td title="@(item.Item.Name)">
                                        <div class="media">
                                            <a class="pull-left" href="@(string.Format("{0}/{1}.html", WebSite.Item, item.Item.Id))" target="_blank">
                                                <img data-src="holder.js/64x64" class="media-object" alt="64x64" style="width: 64px;
                                                    height: 64px;" src="">
                                            </a>
                                            <div class="media-body">
                                                <h5 class="media-heading">
                                                    <span id="item-name-@(item.Item.Id)">@(item.Item.Name)</span> <a title="修改名称" data-trigger="modal" href="/item/name/@(item.Item.Id)"
                                                                                                                                        data-title="修改名称"  class="edit">
                                                        <i class="icon-pencil"></i>&nbsp;</a>
                                                </h5>
                                                <div id="item-name-sub-@(item.Item.Id)">@(item.Item.SubName)
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <span id="item-price-@(item.Item.Id)">
                                            @(item.Item.Price.ToString("N"))</span> <a title="修改价格" data-trigger="modal" href="/item/price/@(item.Item.Id)"
                                                                                                          data-title="修改价格"  class="edit">
                                                <i class="icon-pencil"></i>&nbsp;</a>
                                    </td>
                                    <td>
                                        <span id="item-quantity-@(item.Item.Id)">
                                            @item.Item.Quantity</span> <a title="修改库存" data-trigger="modal" href="/item/quantity/@(item.Item.Id)"
                                                                                             data-title="修改库存"  class="edit"><i class="icon-pencil">
                                                </i>&nbsp;</a>
                                    </td>
                                    <td>
                                        @item.Item.Sale
                                    </td>
                                    <td>
                                        <span>@(item.Item.OnlineTime.ToString("yyyy-MM-dd"))</span>
                                        <br />
                                        <span>@(item.Item.OnlineTime.ToString("HH:mm:ss"))</span>
                                    </td>
                                </tr>
                                <tr class="item-footer">
                                    <td colspan="5">
                                    </td>
                                </tr>
                            </tbody>)
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<style type="text/css">
    .ui-table-alpha tbody tr a.edit { text-decoration: none; margin-left: 10px; }
    .ui-table-alpha tbody a.edit:hover { text-decoration: none; }
</style>
<script type="text/javascript">
    function editPrice(id, obj) {
        var action = "";
        var param = {};
        $.postJSON(action, param, function (result) {

        })
    }
    $(function () {
        $('[data-rel="popover"]').popover();
    });
</script>
